/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package doan.quanlycanbo.portlet.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import doan.quanlycanbo.portlet.model.donvi;
import doan.quanlycanbo.portlet.model.donviModel;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

/**
 * The base model implementation for the donvi service. Represents a row in the &quot;donvi&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link doan.quanlycanbo.portlet.model.donviModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link donviImpl}.
 * </p>
 *
 * <p>
 * Never modify or reference this class directly. All methods that expect a donvi model instance should use the {@link doan.quanlycanbo.portlet.model.donvi} interface instead.
 * </p>
 *
 * @author Nguyen Tuan Vinh
 * @see donviImpl
 * @see doan.quanlycanbo.portlet.model.donvi
 * @see doan.quanlycanbo.portlet.model.donviModel
 * @generated
 */
public class donviModelImpl extends BaseModelImpl<donvi> implements donviModel {
	public static final String TABLE_NAME = "donvi";
	public static final Object[][] TABLE_COLUMNS = {
			{ "madonvi", new Integer(Types.BIGINT) },
			{ "groupId", new Integer(Types.BIGINT) },
			{ "companyId", new Integer(Types.BIGINT) },
			{ "languageId", new Integer(Types.VARCHAR) },
			{ "makhoi", new Integer(Types.BIGINT) },
			{ "donvicha", new Integer(Types.BIGINT) },
			{ "orgId", new Integer(Types.BIGINT) },
			{ "tendonvi", new Integer(Types.VARCHAR) },
			{ "diachi", new Integer(Types.VARCHAR) },
			{ "dienthoai", new Integer(Types.VARCHAR) },
			{ "fax", new Integer(Types.VARCHAR) },
			{ "email", new Integer(Types.VARCHAR) },
			{ "website", new Integer(Types.VARCHAR) },
			{ "hinhanh", new Integer(Types.VARCHAR) },
			{ "gioithieuchung", new Integer(Types.VARCHAR) }
		};
	public static final String TABLE_SQL_CREATE = "create table donvi (madonvi LONG not null primary key,groupId LONG,companyId LONG,languageId VARCHAR(75) null,makhoi LONG,donvicha LONG,orgId LONG,tendonvi VARCHAR(75) null,diachi VARCHAR(75) null,dienthoai VARCHAR(75) null,fax VARCHAR(75) null,email VARCHAR(75) null,website VARCHAR(75) null,hinhanh VARCHAR(75) null,gioithieuchung VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table donvi";
	public static final String ORDER_BY_JPQL = " ORDER BY donvi.tendonvi DESC";
	public static final String ORDER_BY_SQL = " ORDER BY donvi.tendonvi DESC";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.doan.quanlycanbo.portlet.model.donvi"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.doan.quanlycanbo.portlet.model.donvi"),
			true);
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.doan.quanlycanbo.portlet.model.donvi"));

	public donviModelImpl() {
	}

	public long getPrimaryKey() {
		return _madonvi;
	}

	public void setPrimaryKey(long pk) {
		setMadonvi(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_madonvi);
	}

	public long getMadonvi() {
		return _madonvi;
	}

	public void setMadonvi(long madonvi) {
		if (!_setOriginalMadonvi) {
			_setOriginalMadonvi = true;

			_originalMadonvi = _madonvi;
		}

		_madonvi = madonvi;
	}

	public long getOriginalMadonvi() {
		return _originalMadonvi;
	}

	public long getGroupId() {
		return _groupId;
	}

	public void setGroupId(long groupId) {
		if (!_setOriginalGroupId) {
			_setOriginalGroupId = true;

			_originalGroupId = _groupId;
		}

		_groupId = groupId;
	}

	public long getOriginalGroupId() {
		return _originalGroupId;
	}

	public long getCompanyId() {
		return _companyId;
	}

	public void setCompanyId(long companyId) {
		_companyId = companyId;
	}

	public String getLanguageId() {
		if (_languageId == null) {
			return StringPool.BLANK;
		}
		else {
			return _languageId;
		}
	}

	public void setLanguageId(String languageId) {
		_languageId = languageId;
	}

	public long getMakhoi() {
		return _makhoi;
	}

	public void setMakhoi(long makhoi) {
		_makhoi = makhoi;
	}

	public long getDonvicha() {
		return _donvicha;
	}

	public void setDonvicha(long donvicha) {
		_donvicha = donvicha;
	}

	public long getOrgId() {
		return _orgId;
	}

	public void setOrgId(long orgId) {
		_orgId = orgId;
	}

	public String getTendonvi() {
		if (_tendonvi == null) {
			return StringPool.BLANK;
		}
		else {
			return _tendonvi;
		}
	}

	public void setTendonvi(String tendonvi) {
		_tendonvi = tendonvi;
	}

	public String getDiachi() {
		if (_diachi == null) {
			return StringPool.BLANK;
		}
		else {
			return _diachi;
		}
	}

	public void setDiachi(String diachi) {
		_diachi = diachi;
	}

	public String getDienthoai() {
		if (_dienthoai == null) {
			return StringPool.BLANK;
		}
		else {
			return _dienthoai;
		}
	}

	public void setDienthoai(String dienthoai) {
		_dienthoai = dienthoai;
	}

	public String getFax() {
		if (_fax == null) {
			return StringPool.BLANK;
		}
		else {
			return _fax;
		}
	}

	public void setFax(String fax) {
		_fax = fax;
	}

	public String getEmail() {
		if (_email == null) {
			return StringPool.BLANK;
		}
		else {
			return _email;
		}
	}

	public void setEmail(String email) {
		_email = email;
	}

	public String getWebsite() {
		if (_website == null) {
			return StringPool.BLANK;
		}
		else {
			return _website;
		}
	}

	public void setWebsite(String website) {
		_website = website;
	}

	public String getHinhanh() {
		if (_hinhanh == null) {
			return StringPool.BLANK;
		}
		else {
			return _hinhanh;
		}
	}

	public void setHinhanh(String hinhanh) {
		_hinhanh = hinhanh;
	}

	public String getGioithieuchung() {
		if (_gioithieuchung == null) {
			return StringPool.BLANK;
		}
		else {
			return _gioithieuchung;
		}
	}

	public void setGioithieuchung(String gioithieuchung) {
		_gioithieuchung = gioithieuchung;
	}

	public donvi toEscapedModel() {
		if (isEscapedModel()) {
			return (donvi)this;
		}
		else {
			return (donvi)Proxy.newProxyInstance(donvi.class.getClassLoader(),
				new Class[] { donvi.class }, new AutoEscapeBeanHandler(this));
		}
	}

	public ExpandoBridge getExpandoBridge() {
		if (_expandoBridge == null) {
			_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
					donvi.class.getName(), getPrimaryKey());
		}

		return _expandoBridge;
	}

	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		getExpandoBridge().setAttributes(serviceContext);
	}

	public Object clone() {
		donviImpl donviImpl = new donviImpl();

		donviImpl.setMadonvi(getMadonvi());

		donviModelImpl donviModelImpl = donviImpl;

		donviModelImpl._originalMadonvi = donviModelImpl._madonvi;

		donviModelImpl._setOriginalMadonvi = false;
		donviImpl.setGroupId(getGroupId());

		donviModelImpl._originalGroupId = donviModelImpl._groupId;

		donviModelImpl._setOriginalGroupId = false;
		donviImpl.setCompanyId(getCompanyId());

		donviImpl.setLanguageId(getLanguageId());

		donviImpl.setMakhoi(getMakhoi());

		donviImpl.setDonvicha(getDonvicha());

		donviImpl.setOrgId(getOrgId());

		donviImpl.setTendonvi(getTendonvi());

		donviImpl.setDiachi(getDiachi());

		donviImpl.setDienthoai(getDienthoai());

		donviImpl.setFax(getFax());

		donviImpl.setEmail(getEmail());

		donviImpl.setWebsite(getWebsite());

		donviImpl.setHinhanh(getHinhanh());

		donviImpl.setGioithieuchung(getGioithieuchung());

		return donviImpl;
	}

	public int compareTo(donvi donvi) {
		int value = 0;

		value = getTendonvi().compareTo(donvi.getTendonvi());

		value = value * -1;

		if (value != 0) {
			return value;
		}

		return 0;
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		donvi donvi = null;

		try {
			donvi = (donvi)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long pk = donvi.getPrimaryKey();

		if (getPrimaryKey() == pk) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return (int)getPrimaryKey();
	}

	public String toString() {
		StringBundler sb = new StringBundler(31);

		sb.append("{madonvi=");
		sb.append(getMadonvi());
		sb.append(", groupId=");
		sb.append(getGroupId());
		sb.append(", companyId=");
		sb.append(getCompanyId());
		sb.append(", languageId=");
		sb.append(getLanguageId());
		sb.append(", makhoi=");
		sb.append(getMakhoi());
		sb.append(", donvicha=");
		sb.append(getDonvicha());
		sb.append(", orgId=");
		sb.append(getOrgId());
		sb.append(", tendonvi=");
		sb.append(getTendonvi());
		sb.append(", diachi=");
		sb.append(getDiachi());
		sb.append(", dienthoai=");
		sb.append(getDienthoai());
		sb.append(", fax=");
		sb.append(getFax());
		sb.append(", email=");
		sb.append(getEmail());
		sb.append(", website=");
		sb.append(getWebsite());
		sb.append(", hinhanh=");
		sb.append(getHinhanh());
		sb.append(", gioithieuchung=");
		sb.append(getGioithieuchung());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(49);

		sb.append("<model><model-name>");
		sb.append("doan.quanlycanbo.portlet.model.donvi");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>madonvi</column-name><column-value><![CDATA[");
		sb.append(getMadonvi());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>groupId</column-name><column-value><![CDATA[");
		sb.append(getGroupId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>companyId</column-name><column-value><![CDATA[");
		sb.append(getCompanyId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>languageId</column-name><column-value><![CDATA[");
		sb.append(getLanguageId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>makhoi</column-name><column-value><![CDATA[");
		sb.append(getMakhoi());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>donvicha</column-name><column-value><![CDATA[");
		sb.append(getDonvicha());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>orgId</column-name><column-value><![CDATA[");
		sb.append(getOrgId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>tendonvi</column-name><column-value><![CDATA[");
		sb.append(getTendonvi());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>diachi</column-name><column-value><![CDATA[");
		sb.append(getDiachi());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>dienthoai</column-name><column-value><![CDATA[");
		sb.append(getDienthoai());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>fax</column-name><column-value><![CDATA[");
		sb.append(getFax());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>email</column-name><column-value><![CDATA[");
		sb.append(getEmail());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>website</column-name><column-value><![CDATA[");
		sb.append(getWebsite());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>hinhanh</column-name><column-value><![CDATA[");
		sb.append(getHinhanh());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>gioithieuchung</column-name><column-value><![CDATA[");
		sb.append(getGioithieuchung());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _madonvi;
	private long _originalMadonvi;
	private boolean _setOriginalMadonvi;
	private long _groupId;
	private long _originalGroupId;
	private boolean _setOriginalGroupId;
	private long _companyId;
	private String _languageId;
	private long _makhoi;
	private long _donvicha;
	private long _orgId;
	private String _tendonvi;
	private String _diachi;
	private String _dienthoai;
	private String _fax;
	private String _email;
	private String _website;
	private String _hinhanh;
	private String _gioithieuchung;
	private transient ExpandoBridge _expandoBridge;
}